package com.sammier.snake;

import javax.swing.*;
import java.awt.*;
import java.net.URL;

//数据中心
public class Data {

    //相对路径    tx.jpg
    // 绝对路径  相当于当前的项目
    private  static URL headerURL = Data.class.getResource("statics/header_Gu.jpg");
    public static ImageIcon header = new ImageIcon(headerURL);

    private  static URL upURL = Data.class.getResource("statics/up.png");
    private  static URL downURL = Data.class.getResource("statics/down.png");
    private  static URL leftURL = Data.class.getResource("statics/left.png");
    private  static URL rightURL = Data.class.getResource("statics/right.png");
    public static ImageIcon up = new ImageIcon(upURL);
    public static ImageIcon down = new ImageIcon(downURL);
    public static ImageIcon left = new ImageIcon(leftURL);
    public static ImageIcon right = new ImageIcon(rightURL);

    public  static URL bodyURL = Data.class.getResource("statics/body.png");
    public  static ImageIcon body = new ImageIcon(bodyURL);

    public  static URL foodURL = Data.class.getResource("statics/food.png");
    public  static ImageIcon food = new ImageIcon(foodURL);

    //加入两种苹果
    public static URL good_appleURL = Data.class.getResource("statics/goodapple.png");
    public  static ImageIcon good_apple = new ImageIcon(good_appleURL);

    public static URL bad_appleURL = Data.class.getResource("statics/badapple.png");
    public  static ImageIcon bad_apple = new ImageIcon(bad_appleURL);


    static {
        //调整good_apple大小
        Image good_appleImage = good_apple.getImage();
        Image scale_good_apple_Image = good_appleImage.getScaledInstance(25, 25, Image.SCALE_SMOOTH);
        good_apple = new ImageIcon(scale_good_apple_Image);
        //修改bad_apple大小
        Image bad_appleImage = bad_apple.getImage();
        Image scale_bad_apple_Image = bad_appleImage.getScaledInstance(25, 25, Image.SCALE_SMOOTH);
        bad_apple = new ImageIcon(scale_bad_apple_Image);
        //修改header大小
        Image Header_image = header.getImage();
        Image scale_Header_Image = Header_image.getScaledInstance(850, 50, Image.SCALE_SMOOTH);
        header = new ImageIcon(scale_Header_Image);
    }
}
